import Vue from 'vue';

import viewer from './_viewer.vue';

const Viewer = Vue.extend(viewer);

export default (options) => {
    const instance = new Viewer({
        propsData: options
    });
    instance.vm = instance.$mount();
    document.body.appendChild(instance.vm.$el);
    instance.vm.$on('viewer_hidden', () => {
        //点击关闭按钮后删除vue对象及dom对象
        instance.vm.$destroy()
        document.body.removeChild(instance.vm.$el)

    })
    return instance.vm;
};
